package com.kinggm.service.decorator.io;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class IODecoratorTest {


    public static void main(String[] args) {
        String file = "C:\\Users\\Administrator\\Desktop\\123.txt";
        int c;

        try {
            InputStream in =
                    new BufferedInputStream(
                            new FileInputStream(file));
            while ((c = in.read()) >= 0) {
                System.out.print((char) c);
            }
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        System.out.println();
        try {
            // 使用包装类
            InputStream in =
                    new LowerCaseInputStream(
                            new BufferedInputStream(
                                    new FileInputStream(file)));
            while ((c = in.read()) >= 0) {
                System.out.print((char) c);
            }
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
